/*
  数组的类型
    类型[]
    Array<类型>
*/
let arr: number[]
let arr1: Array<number>
// 推荐这种写法，即该数组中可以存放 number 或 string
let arr2: (number | string)[]
let arr3: Array<number | string>

/*
  元组，元组就是固定长度的数组
      变量名: [类型,类型]
*/
let tupleArr: [string, number]
tupleArr = ["hellow", 100]

/*
  enum 枚举
*/
enum List {
  Male = 0,
  Female = 1
}

let enumList: { name: string, gender: List }
enumList = {
  name: "孙悟空",
  gender: List.Male
}
console.log(enumList.gender === List.Male)

/*数组和数组元素同时为只读  */
const arr4 = [100, 100] as const

/* 可变元组，既有数组的特点也有元组的特点，前面长度确定，后面长度不确定 */
let custArr: [string, ...number[]] = ["cgc", 100]
let [name1, ...rest] = custArr
console.log("name ==", name1)

/* 可变元组的tag和tag的意义，方便记忆而已了 */
let [name2, ...rest2]: [name2: string, ...rest2: number[]] = custArr
